<div class="groups index">
	<h2><?php echo 'Система - групи потребители'; ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
		<th>
		<?php
			echo $this->Paginator->sort(
				'ID',
				'id',
				array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'index')
			);
		?>
		</th>
		<th>
		<?php
			echo $this->Paginator->sort(
				'Заглавие',
				'title',
				array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'index')
			);
		?>
		</th>
		<th class="actions"><?php echo 'Действия'; ?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($groups as $group) {
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td>
			<?php echo $group['Group']['id']; ?>
		</td>
		<td>
			<?php echo $group['Group']['title']; ?>
		</td>
		<td class="actions">
			<?php echo $this->Html->link('Преглед', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'view', $group['Group']['id'])); ?>
			<?php
				/**
				 * Ako ne e ot zapazenite grupi, togava pokazvame dadenoto deistvie
				 */
				if (($group['Group']['id']!=1) && ($group['Group']['id']!=2)) {
					echo $this->Html->link('Редактиране', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'edit', $group['Group']['id']));
					echo $this->Html->link('Изтриване', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'delete', $group['Group']['id']), null, sprintf('Сигурни ли сте, че искате да изтриете # %s?', $group['Group']['id']));
				}
			?>
		</td>
	</tr>
<?php } ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => 'Страницa %page% от %pages%, показваща %current% записа от %count% общо, започваща от запис %start%, свършваща на запис %end%'
	));
	?></p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< '.'предишна', array('url' => array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'index')), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers(array('url' => array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'index')));?>
	 |
		<?php echo $this->Paginator->next('следваща'.' >>', array('url' => array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'index')), null, array('class'=>'disabled'));?>
	</div>
</div>
<div class="actions">
	<h3><?php echo 'Действия:'; ?></h3>
	<ul>
		<li><?php echo $this->Html->link('Добави група', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'add')); ?></li>
	</ul>
</div>